﻿using System;
using System.Windows.Media.Media3D;
using HelixToolkit.Wpf;

namespace GameBoard
{
    internal class SphereVisual : SphereVisual3D, IVisual, ITranslucentTerrain
    {
        bool _belongsToMoveablePicture = false;
        private VisiblityType _opacity;

        public bool BelongsToMoveablePicture
        {
            get { return _belongsToMoveablePicture; }
        }
        public void PopulateVisualData(BaseVisualData theData)
        {
            _belongsToMoveablePicture = theData.BelongsToMoveablePicture;
            FactoryID = theData.FactoryID;

            var sp = theData as SphereVisualData;
            Center = sp.Center;
            Material = sp.Material;
            Radius = sp.Radius;
            IsSolid = !sp.IsNotSolid;
            TranslucentMaterialMaker.MakeMaterialsFromBrush(sp.MaterialBrush, this, sp.IsTransparent);
        }
        public bool IsSolid
        {
            get;
            set;
        }
        public ModelVisual3D VisualElement
        {
            get { return this; }
        }

        public Guid FactoryID { get; set; }

        public VisiblityType Opacity
        {
            get { return _opacity; }
            set 
            { 
                _opacity = value;
                TranslucentMaterialMaker.ChangeCurrentMaterialTo(this, _opacity);
            }
        }

        public DiffuseMaterial InvisibleMaterial { get; set; }
        public DiffuseMaterial VisibleMaterial { get; set; }
        public DiffuseMaterial TranslucentMaterial { get; set; }
    }
}